Repository navigation
fix(fleet-proxy): re-resolve the tailnet egress at tunnel-open time - #13080
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The broker parsed its tailnet egress once at startup. A broker auto-spawned while tailscaled was down (or before bootstrap wrote fleet-proxy.env) kept the ambient egress value — or none — for its whole life, so queue/shell tailnet tunnels kept failing after the tailnet recovered until a manual restart. That is the startup-cache half of the #12426 failure mode, left after the read-time preference landed for #12555 in #12645. Tunnel opens now resolve fresh via egress_from_env (recorded tailnet proxy first, ambient env second), falling back to the startup parse when fresh resolution fails. Opens are pooled and recovery-gated, so the re-read costs one small file read per new tunnel, not per request. The Cloudflare leg's egress is unchanged: the ambient platform proxy is its correct source. Oracle: the resolve_tailnet_egress preference — a fresh resolution wins, the startup parse is the fallback, and with neither the resolution error surfaces. Three unit tests cover the three branches; the fleet-proxy suite passes 113/113.
dezren39
force-pushed
the
lane-lj-12426
branch
from
November 23, 2026 07:59
282fedb to
bc8b3a9
Compare
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12426.
What was still broken
PR #12645 (for #12555) made tailnet tunnel construction prefer the seat's recorded tailnet proxy (
fleet-proxy.env) over the ambientHTTPS_PROXY. Butfleet proxy serveresolved that egress once at startup and cached it in theBrokerfor the process's whole life. A broker auto-spawned while tailscaled was down — or before bootstrap wrotefleet-proxy.env— was born with the ambient egress value (or none) and kept it forever: queue/shell tailnet tunnels stayed broken after the tailnet recovered until someone restarted the broker by hand. That is exactly the outage shape #12555 recorded and the restart path #12426's seat fix had to do manually.The change (one file:
pkgs/fleet/crates/fleet-proxy/src/serve.rs)open_raw_tunnel, and the tailnet branch ofopen_conn_raw) now call a newBroker::tailnet_egress(), which resolves fresh via the existingegress_from_env(recorded tailnet proxy first, ambient env second) on every open.resolve_tailnet_egress: fresh resolution wins; the startup parse is the fallback when fresh resolution fails; with neither, the resolution error (the same message the startup warning prints) surfaces.egress_from_env_url_port) still uses the ambient env, cached at startup — the platform egress proxy is that leg's correct source, and it is not part of the fleet proxy serve inherits the sandbox egress HTTPS_PROXY in userspace mode; queue/shell legs fail until it is restarted with tailscaled's CONNECT proxy #12426 failure mode. The spawn sites (bootstrap hint,spawn_serveenv inheritance) no longer matter for tailnet routing once the value is read at open time, so they are untouched.Verification
tailnet_egress_fresh_resolution_wins_over_the_startup_parse,tailnet_egress_falls_back_to_the_startup_parse,tailnet_egress_without_either_surfaces_the_resolution_error— all pass.cargo test -p fleet-proxy: 113 passed / 0 failed (plus 14 in the crate's other test target), run on the laptop at the PR head's parent state;cargo fmt -p fleet-proxyclean./proc-environ watchdog described on fleet proxy serve: auto-spawned broker inherits the caller ambient proxy env and silently breaks tailnet tunnels #12555.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.